<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>微博发布框</title>
    <style>
        .warn{
            color: red;
        }
    </style>
</head>
<body>
    <div id="app">
        <textarea v-model="content" cols="30" rows="10" placeholder="请发表你今天的心情。。。"></textarea>
        <!-- 当内容数量大于100的时候，字体变成红色进行提示 -->
        <p :class="{warn: content.length >100}">{{content.length}}/100</p>
        <p>
            <!-- 当内容数量大于100的时候不能生效 -->
            <button :disabled = "content.length >100">发布</button>
            <!-- 当内容数量小于等于0的时候不能生效 -->
            <button @click="clear" :disabled = "content.length <=0">清空</button>
        </p>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script>
        var vue = new Vue({
            el:'#app',
            data:{
                content:"",
            },
            methods:{
                clear(){
                    this.content = ""
                }
            }
        })
    </script>
</body>
</html>